package com.mazaiting.lab.controller;

import com.mazaiting.web.auth.security.annotation.PrePermission;
import com.mazaiting.web.domain.SingleResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Sentinel接口
 */
@Slf4j
@RestController
@RequestMapping("lab/v1/sentinel")
@RequiredArgsConstructor
public class SentinelController {

    /**
     * 【普通流控】获取数据
     *
     * @return 数据
     */
    @PrePermission("lab:sentinel:query")
    @GetMapping("/flowLimiting")
    public SingleResult getFlowLimitingData() {
        return SingleResult.success("正常数据");
    }

    /**
     * 【网关流控-RouteID】获取数据
     *
     * @return 数据
     */
    @PrePermission("lab:sentinel:query")
    @GetMapping("/gatewayRouteFlowLimiting")
    public SingleResult getGatewayRouteFlowLimitingData() {
        return SingleResult.success("正常数据");
    }

    /**
     * 【网关流控-API分组】获取数据
     *
     * @return 数据
     */
    @PrePermission("lab:sentinel:query")
    @GetMapping("/gatewayApiFlowLimiting")
    public SingleResult getGatewayApiFlowLimitingData() {
        return SingleResult.success("正常数据");
    }

}